/***
 * 创建point
 */
export function newPoint(BMap, point = {}){
    const {lng, lat} = point
    return new BMap.Point(lng, lat)
    // var bm_point = new BMap.Point(point.lng, point.lat)
    // // opt = opt || {};
    // var marker = new BMap.Marker(bm_point);// 创建标注
	// map.addOverlay(marker);             // 将标注添加到地图中
}
/***
 * 添加点
 * opt: 
 * Dragging等
 */
export function addMarker(map, point, opt){
    var bm_point = new BMap.Point(point.lng, point.lat)
    // opt = opt || {};
    var marker = new BMap.Marker(bm_point);// 创建标注
	map.addOverlay(marker);             // 将标注添加到地图中
}
/***
 * 添加线
 * opt
 */
export function addPolyline(map, points, opt){
    points = points.map(item => new BMap.Point(item));
    opt = opt || {strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}
    var polyline = new BMap.Polyline(polyline, opt);// 创建折线
	map.addOverlay(polyline);             // 将标注添加到地图中
}
export const isPoint = obj => obj.lng && obj.lat
export const checkType = val => {
    return Object.prototype.toString.call(val).slice(8, -1)
}